﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LibFriesland_Campina_CRM
{
    public class BizRelatives
    {
        #region Thuoc tinh
        public long relatives_numid { get; set; }
        public string name { get; set; }
        public string datetime_born_str { get; set; }
        public int year_born { get; set; }
        public DateTime datetime_born { get { return Convert.ToDateTime(Thuvien.myConvertStringToShortDate(datetime_born_str)); } }
        public long by_shopper { get; set; }
        #endregion

        #region Ham thiet lap
        public BizRelatives() { }
        public BizRelatives(string pName, int pYear_born)
        {
            name = pName;
            year_born = pYear_born;
        }
        public BizRelatives(long pRelatives_numid, string pName, int pYear_born, long pBy_shopper)
        {
            relatives_numid = pRelatives_numid;
            name = pName;
            year_born = pYear_born;
            by_shopper = pBy_shopper;
        }
        #endregion

        #region Phuong thuc
        //Them mot than nhan
        public int addRelatives()
        {
            return DalRelatives.addRelatives(this);
        }

        //Lay ID cua than nhan
        public static long getRelativesNumID(string pName, long pBy_shopper)
        {
            return DalRelatives.getRelativesNumID(pName, pBy_shopper);
        }

        //Cap nhat thong tin thanh nhan
        public int updateRelatives()
        {
            return DalRelatives.updateRelatives(this);
        }

        //Lay danh sach than nhan theo khach hang
        public static List<BizRelatives> getRelativesbyShopper(long pBy_shopper)
        {
            return DalRelatives.getRelativesbyShopper(pBy_shopper);
        }
        #endregion
    }
}
